'''
A script that runs our UDP Client-Server application under TwistedSim.

@author: Hatem Oraby
'''

import twistedSim.simManager as simManager 
from twistedSim.moduleHandler import twistedH

import os

if __name__ == '__main__':

    machine1 = simManager.Machine()
    
    #Server Module
    path  = os.path.realpath(".") + "//Server"
    module1 = simManager.Module('echoserv_udp', twistedH(), path)
    simManager.SimManager.addModule(module1,machine1)
    
    #Client Module
    path  = os.path.realpath(".") + "//Client"
    module2 = simManager.Module('echoclient_udp', twistedH(),
                                path, startTime = 1)
    simManager.SimManager.addModule(module2, machine1)
    
    simManager.SimManager.run()